package com.example.swimmingpool.converter;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.metadata.property.ExcelContentProperty;

import java.time.LocalDate;

public class SexConverter implements Converter<Integer> {
    @Override
    public WriteCellData<?> convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        var sex = switch (value) {
            case 0 -> "男";
            case 1 -> "女";
            default -> throw new IllegalArgumentException("the value must in the [0,1] !");
        };
        return new WriteCellData<>(sex);
    }
}
